package Date;

import java.util.Scanner;

/**
 * @Author Stringzhua
 * @Date 2024/4/21 14:03
 * description:
 */
public class test02 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = 0;
        //在此输入您的代码...
        String date = scan.nextLine();
        for (int i = 1900; i < 9999; i++) {//年份1900~9999
            //判断是闰年还是平年
            int a;//2月份
            if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
                //是闰年
                a = 29;
            } else {
                a = 28;
            }
            //计算每月份的天数1~12
            for (int j = 1; j <= 12; j++) {
                int b;//除了2月份的其他月份
                if (j == 1 || j == 3 || j == 5 || j == 7 || j == 8 || j == 10 || j == 12) {
                    b = 31;//31天
                } else if (j == 2) {
                    b = a;
                } else {
                    b = 30;
                }

                //判断
                for (int k = 1; k <= b; k++) {
                    int yfirst = i / 1000;
                    int ysecond = i / 100 - i / 1000 * 10;
                    int ythird = i / 10 - i / 100 * 10;
                    int yfour = i % 10;

                    int date1 = j / 10 + j % 10;
                    int date2 = k / 10 + k % 10;

                    if (yfirst + ysecond + ythird + yfour == date1 + date2) {
                        num++;
                    }
                }

            }
        }
        System.out.println(num);
        scan.close();
    }
}
